package model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Terminplaner {
	
	private List<Termin> termine;
	
	

	public Terminplaner() {
		
		termine = new ArrayList<Termin>();
	}

	public List<Termin> getTermine() {
		return Collections.unmodifiableList(termine);
	}

	public void setTermine(List<Termin> termine) {
		if(termine == null)
		   throw new IllegalArgumentException("termine darf nicht null sein!");
		if(termine.isEmpty())
		   throw new IllegalArgumentException("termine darf nicht leer sein!");   
		this.termine = termine;
	}
	
		public void addTermin(Termin termin)
	{if(termin != null)
	   termine.add(termin);
	else
		throw new IllegalArgumentException("termin darf nicht null sein!");
		
	}
	public void removeTermin(Termin termin)
	{if(termin != null)
	   termine.remove(termin);
	else
		throw new IllegalArgumentException("termin darf nicht null sein!");
		
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((termine == null) ? 0 : termine.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Terminplaner other = (Terminplaner) obj;
		if (termine == null) {
			if (other.termine != null)
				return false;
		} else if (!termine.equals(other.termine))
			return false;
		return true;
	}
	
	
	
	

}
